SELECT     CASE WHEN cc.definition IS NULL THEN 0 ELSE 1 END AS is_computed, cc.definition AS formula, COLUMNPROPERTY(OBJECT_ID(c.TABLE_NAME), 
                      c.COLUMN_NAME, 'IsIdentity') AS is_identity, CASE WHEN
                          (SELECT     tc.constraint_type
                            FROM          information_schema.table_constraints tc
                            WHERE      tc.table_name = kcu.table_name AND kcu.constraint_name = tc.constraint_name AND tc.constraint_type = 'PRIMARY KEY') IS NULL 
                      THEN 0 ELSE 1 END AS 'is_primary_key', CASE WHEN
                          (SELECT     tc.constraint_type
                            FROM          information_schema.table_constraints tc
                            WHERE      tc.table_name = kcu.table_name AND kcu.constraint_name = tc.constraint_name AND tc.constraint_type = 'FOREIGN KEY') IS NULL 
                      THEN 0 ELSE 1 END AS 'is_foreign_key', c.TABLE_CATALOG, c.TABLE_SCHEMA, c.TABLE_NAME, c.COLUMN_NAME, c.ORDINAL_POSITION, c.COLUMN_DEFAULT, 
                      c.IS_NULLABLE, c.DATA_TYPE, c.CHARACTER_MAXIMUM_LENGTH, c.CHARACTER_OCTET_LENGTH, c.NUMERIC_PRECISION, c.NUMERIC_PRECISION_RADIX, 
                      c.NUMERIC_SCALE, c.DATETIME_PRECISION, c.CHARACTER_SET_CATALOG, c.CHARACTER_SET_SCHEMA, c.CHARACTER_SET_NAME, c.COLLATION_CATALOG, 
                      c.COLLATION_SCHEMA, c.COLLATION_NAME, c.DOMAIN_CATALOG, c.DOMAIN_SCHEMA, c.DOMAIN_NAME
FROM         INFORMATION_SCHEMA.COLUMNS AS c LEFT OUTER JOIN
                      INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS kcu ON c.TABLE_NAME = kcu.TABLE_NAME AND c.COLUMN_NAME = kcu.COLUMN_NAME LEFT OUTER JOIN
                      sys.computed_columns AS cc ON cc.object_id = OBJECT_ID(@table_name) AND cc.name = c.COLUMN_NAME
WHERE     (c.TABLE_NAME = @table_name)